import { defineStore, acceptHMRUpdate } from 'pinia'

export type itemType = {
  id:number,
  label:string,
  path:string,
  key:string
}
export interface objectArray {
  rows: Record<string, string | number>
}
export const useSystemStore = defineStore({
    id: 'system',
    state: () => ({
      recordList:[],
      tabIndex:'',
    }),
    actions: {
      isExist(label:string){//判断标签是否已经打开
        return this.recordList.some((item:itemType)=> item.label == label)
      },
      newList(list:[]){
        this.recordList = list
      },
      addList(obj:itemType){
        if(!this.isExist(obj.label)){
          this.recordList.push(obj as never)
        }
        this.recordList.push
      },
      changeTabIdx(tab:string){
        this.tabIndex = tab
      }
    },
}) 
